import request from '../utils/request';
/**
 * UC 会员中心API资源文件
 * 
 * @author 小兔
 * @Date 20210905
 * @description
 */
 var uc_base_uri_req = "http://127.0.0.1:4890/portal";

// Member 会员管理 --------------------------------------------------------------------Start
/**
 * 平台用户查询
 * @param {*} query 
 * @returns 
 */
export const fetchMemberData = query => {
    return request({
        url: uc_base_uri_req+'/admin/sys/member/findSysMemberListPage',
        method: 'get',
        params: query
    });
};
/**
 * 平台用户详细查询
 * @param {*} query 
 * @returns 
 */
 export const fetchMemberInfoData = query => {
    return request({
        url: uc_base_uri_req+'/admin/sys/member/info/'+query,
        method: 'get',
    });
};
export const addSysMember = v => {
    return request({
        url: uc_base_uri_req+ '/admin/sys/member/saveSysMemberInfo',
        method: 'post',
        data: v
    });
};
export const saveSysMember = v => {
    return request({
        url: uc_base_uri_req+ '/admin/sys/member/saveSysMemberInfo',
        method: 'put',
        data: v
    });
};
/**
 * 平台用户批量删除
 * @param {*} query 
 * @returns 
 */
 export const batchDelMember = v => {
    return request({
        url: uc_base_uri_req+'/admin/sys/member/ad/edit/batchDelMember',
        method: 'post',
        data: v
    });
};
/**
 * 平台用户批量回收
 * @param {*} query 
 * @returns 
 */
 export const batchRecMember = v => {
    return request({
        url: uc_base_uri_req+'/admin/sys/member/batchEditSysMemberStatus',
        method: 'put',
        data: v
    });
};
/**
 * 平台用户批量回收
 * @param {*} query 
 * @returns 
 */
 export const batchActMember = v => {
    return request({
        url: uc_base_uri_req+'/admin/sys/member/batchEditSysMemberStatus',
        method: 'put',
        data: v
    });
};
// Member 会员管理 --------------------------------------------------------------------End
// Member 角色管理 --------------------------------------------------------------------Start
/**
 * 平台角色查询
 * @param {*} query 
 * @returns 
 */
export const fetchRoleData = query => {
    return request({
        url: uc_base_uri_req+'/r/fetch',
        method: 'get',
        params: query
    });
};
/**
 * 平台角色下拉选项查询
 * @param {*} query 
 * @returns 
 */
 export const fetchRoleOptData = query => {
    return request({
        url: uc_base_uri_req+'/r/fetchRoleOptions',
        method: 'get',
        params: query
    });
};
/**
 * 系统角色编辑保存
 * @param {*} query 
 * @returns 
 */
 export const editRole = v => {
    return request({
        url: uc_base_uri_req+'/r/editRoler',
        method: 'post',
        data: v
    });
};
/**
 * 批量删除系统角色
 * @param {*} query 
 * @returns 
 */
 export const batchDelRoler = v => {
    return request({
        url: uc_base_uri_req+'/r/batchDelRoler',
        method: 'post',
        data: v
    });
};
/**
 * 批量恢复系统角色
 * @param {*} query 
 * @returns 
 */
export const batchRecRoler = v => {
    return request({
        url: uc_base_uri_req+'/r/batchRecRoler',
        method: 'post',
        data: v
    });
};
/**
 * 批量激活关闭角色状态
 * @param {*} query 
 * @returns 
 */
 export const batchActRoler = v => {
    return request({
        url: uc_base_uri_req + '/r/batchActRoler',
        method: 'post',
        data: v
    });
};
// Member 角色管理 --------------------------------------------------------------------End
// Member 资源管理 --------------------------------------------------------------------Start
/**
 * 系统可访问资源查询
 * @param {*} query 
 * @returns 
 */
export const fetchResouseData = query => {
    return request({
        url: uc_base_uri_req+'/re/fetch',
        method: 'get',
        params: query
    });
};
/**
 * 系统可访问资源查询
 * @param {*} query 
 * @returns 
 */
 export const fetchOptionResouseData = query => {
    return request({
        url: uc_base_uri_req+'/re/fetchOptions',
        method: 'get',
        params: query
    });
};
/**
 * 系统资源编辑保存
 * @param {*} query 
 * @returns 
 */
 export const editResouser = v => {
    return request({
        url: uc_base_uri_req+'/re/editResouser',
        method: 'post',
        data: v
    });
};
/**
 * 系统资源批量删除
 * @param {*} query 
 * @returns 
 */
 export const batchDelResouser = v => {
    return request({
        url: uc_base_uri_req+'/re/batchDelResouser',
        method: 'post',
        data: v
    });
};
/**
 * 系统资源批量回收
 * @param {*} query 
 * @returns 
 */
 export const batchRecResouser = v => {
    return request({
        url: uc_base_uri_req+'/re/batchRecResouser',
        method: 'post',
        data: v
    });
};
/**
 * 系统资源批量回收
 * @param {*} query 
 * @returns 
 * @description 普通用户不可见资源
 */
 export const batchHiddenResouser = v => {
    return request({
        url: uc_base_uri_req+'/re/batchHiddenResouser',
        method: 'post',
        data: v
    });
};
/**
 * 系统资源批量回收
 * @param {*} query 
 * @returns 
 * @description 普通用户可见资源
 */
 export const batchUnHiddenResouser = v => {
    return request({
        url: uc_base_uri_req+'/re/batchUnHiddenResouser',
        method: 'post',
        data: v
    });
};
// Member 资源管理 --------------------------------------------------------------------End
// Member 权限管理 --------------------------------------------------------------------Start
/**
 * 权限查询
 * @param {*} query 
 * @returns 
 */
export const fetchPermissionData = query => {
    return request({
        url: uc_base_uri_req+'/p/fetch',
        method: 'get',
        params: query
    });
};
// Member 权限管理 --------------------------------------------------------------------End
// Member 用户角色管理 --------------- ------------------------------------------------Start
/**
 * 角色内用户关联查询
 * @param {*} query 
 * @returns 
 */
export const fetchRoleMembers = query =>{
    return request({
        url: uc_base_uri_req + '/r/fetchRoleMemberConn',
        method: 'get',
        params: query
    });
};
/**
 * 用户内角色关联查询
 * @param {*} query 
 * @returns 
 */
 export const fetchMemberRoles = query => {
    return request({
        url: uc_base_uri_req + '/r/fetchMemberRoleConn',
        method: 'get',
        params: query
    });
};
/**
 * 角色内用户关联编辑
 * @param {*} query 
 * @returns 
 */
export const editRoleMemberConn = v => {
    return request({
        url: uc_base_uri_req + '/r/edit/roleMemberConn',
        method: 'post',
        data: v
    });
};
/**
 * 角色内用户关联删除
 * @param {*} query 
 * @returns 
 */
export const delRoleMemberConn = v => {
    return request({
        url: uc_base_uri_req + '/r/edit/delMemberConn',
        method: 'post',
        data: v
    });
};
// Member 用户角色管理 --------------- ------------------------------------------------end
// Member 资源角色管理 --------------- ------------------------------------------------start
export const fetchRoleResouses = query =>{
    return request({
        url: uc_base_uri_req + '/r/fetchRoleResouseConnWithChild',
        method: 'get',
        params: query
    });
};
export const editRoleResouseConn = v =>{
    return request({
        url: uc_base_uri_req + '/r/edit/roleResouseConn',
        method: 'post',
        data: v
    });
};
export const delRoleResouseConn = v =>{
    return request({
        url: uc_base_uri_req + '/r/edit/delResouseConn',
        method: 'post',
        data: v
    });
};
// Member 资源角色管理 --------------- ------------------------------------------------end